
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class RxEngine extends Thread
{
	private DatagramSocket socket;

	
	public RxEngine(DatagramSocket ds)
	{
		socket = ds;	
	}

	public EthernetFrame receive() throws InstantiationException, IOException
	{
		byte [] buffer = new byte [1526];
		DatagramPacket receivedPacket = new DatagramPacket(buffer, buffer.length);
		socket.receive(receivedPacket);
		
		EthernetFrame receivedMessage = new EthernetFrame(receivedPacket.getData());
		
		return receivedMessage;
		
	}
	
}